﻿#pragma once

#include "tradebase_global.h"
#include <memory>
#include <atomic>

class TRADEBASE_EXPORT TradeBlocker : public std::enable_shared_from_this<TradeBlocker>
{

public:
	// 阻塞的毫秒数
	TradeBlocker(int pBlockSeconds);
	~TradeBlocker();

	void BlockCTP();

	// 停止阻塞的信号
	void StopBlock();
	
private:
	std::atomic<int > m_blockTimes;
};

typedef std::shared_ptr<TradeBlocker> BlockerSmart;
namespace Blocker
{
	// 创建一个定时器
	BlockerSmart TRADEBASE_EXPORT Create(int pBlockSeconds);
	// 停止一个定时器
	void TRADEBASE_EXPORT Stop(BlockerSmart pBlocker);
}